<?php

namespace cesi\plastprodBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;

/**
 * @ORM\Entity(repositoryClass="cesi\plastprodBundle\Repository\UserRepository")
 * @ORM\Table(name="users")
 */
class User implements UserInterface {

    /**
     * @ORM\Id
     * @ORM\Column(name="user_id", type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $user_id;

    /**
     * @ORM\Column(type="string")
     */
    protected $user_login;

    /**
     * @ORM\Column(type="string")
     */
    protected $user_password;

    /**
     * @ORM\Column(type="string")
     */
    protected $user_mail;

    /**
     * @ORM\Column(type="string", nullable=true)
     */
    protected $user_firstname;

    /**
     * @ORM\Column(type="string", nullable=true)
     */
    protected $user_lastname;

    /**
     * @ORM\Column(type="datetime")
     */
    protected $user_subscribe_date;

    /**
     * @ORM\Column(type="integer")
     */
    protected $user_status;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    protected $user_sex;

     /**
     * @ORM\Column(type="string", nullable=true)
     */
    protected $country;


    

    /**
     * Get user_id
     *
     * @return integer 
     */

    /**
     * @var string $salt
     *
     * @ORM\Column(name="salt", type="string", length=255)
     */
    protected $salt;

    public function getUserId() {
        return $this->user_id;
    }

    /**
     * Set user_login
     *
     * @param string $userLogin
     */
    public function setUserLogin($userLogin) {
        $this->user_login = $userLogin;
    }

    /**
     * Get user_login
     *
     * @return string 
     */
    public function getUserLogin() {
        return $this->user_login;
    }

    /**
     * Set user_password
     *
     * @param string $userPassword
     */
    public function setUserPassword($userPassword) {
        $this->user_password = $userPassword;
    }

    /**
     * Get user_password
     *
     * @return string 
     */
    public function getUserPassword() {
        return $this->user_password;
    }

    /**
     * Set user_mail
     *
     * @param string $userMail
     */
    public function setUserMail($userMail) {
        $this->user_mail = $userMail;
    }

    /**
     * Get user_mail
     *
     * @return string 
     */
    public function getUserMail() {
        return $this->user_mail;
    }

    /**
     * Set user_firstname
     *
     * @param string $userFirstname
     */
    public function setUserFirstname($userFirstname) {
        $this->user_firstname = $userFirstname;
    }

    /**
     * Get user_firstname
     *
     * @return string 
     */
    public function getUserFirstname() {
        return $this->user_firstname;
    }

    /**
     * Set user_lastname
     *
     * @param string $userLastname
     */
    public function setUserLastname($userLastname) {
        $this->user_lastname = $userLastname;
    }

    /**
     * Get user_lastname
     *
     * @return string 
     */
    public function getUserLastname() {
        return $this->user_lastname;
    }


    /**
     * Set user_subscribe_date
     *
     * @param date $userSubscribeDate
     */
    public function setUserSubscribeDate($userSubscribeDate) {
        $this->user_subscribe_date = $userSubscribeDate;
    }

    /**
     * Get user_subscribe_date
     *
     * @return date 
     */
    public function getUserSubscribeDate() {
        return $this->user_subscribe_date;
    }

    /**
     * Set user_status
     *
     * @param integer $userStatus
     */
    public function setUserStatus($userStatus) {
        $this->user_status = $userStatus;
    }

    /**
     * Get user_status
     *
     * @return integer 
     */
    public function getUserStatus() {
        return $this->user_status;
    }

    /**
     * Set user_sex
     *
     * @param integer $userSex
     */
    public function setUserSex($userSex) {
        $this->user_sex = $userSex;
    }

    /**
     * Get user_sex
     *
     * @return integer 
     */
    public function getUserSex() {
        return $this->user_sex;
    }

    /**
     * Set country
     *
     * @param string $country
     */
    public function setCountry($country) {
        $this->country = $country;
    }

    /**
     * Get country
     *
     * @return string 
     */
    public function getCountry() {
        return $this->country;
    }

   

    public function getRoles() {
        return array('ROLE_USER');
    }

    public function getPassword() {
        return $this->user_password;
    }

    public function getSalt() {
        return null;
    }

    public function getUserName() {
        return $this->user_login;
    }

    public function equals(UserInterface $user) {
        return $user->getUsername() === $this->user_login;
        //return md5($this->user_login) == md5($user->getUsername());
    }

    public function eraseCredentials() {
        
    }

    /**
     * Set salt
     *
     * @param string $salt
     */
    public function setSalt($salt) {
        $this->salt = $salt;
    }




}